package Vista;

import java.awt.BorderLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.BoxLayout;
import javax.swing.JLabel;
import java.awt.Component;
import java.awt.Color;
import java.awt.Font;
import javax.swing.JComboBox;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JTextField;
import java.awt.Dimension;


public class VistaSeleccionTitular extends JDialog{

	private static final long serialVersionUID = 1L;
	private final JPanel contentPanel = new JPanel();
	private JButton btnComprobar;
	private JButton btnCancelar;
	private final JPanel panelLabels = new JPanel();
	private final JPanel panelTextFields = new JPanel();
	private final JLabel lblUsuario = new JLabel("Tipo de documento:");
	private final JLabel lblContrasea = new JLabel("N\u00FAmero de documento: ");
	private final JPanel panelContrasenia = new JPanel();
	private final JPanel panel_1 = new JPanel();
	private final JLabel lblError = new JLabel("Contrase\u00F1a erronea o usuario inexistente");
	private final JComboBox<String> comboBoxTipoDoc;
	private final JPanel panel_2 = new JPanel();
	private final JPanel panel_3 = new JPanel();
	private final JPanel panel_4 = new JPanel();
	private final JPanel panel_5 = new JPanel();
	private final JPanel panel_6 = new JPanel();
	private final JPanel panel_7 = new JPanel();
	private final JPanel panel_8 = new JPanel();
	private final JPanel panel_9 = new JPanel();
	private final JTextField txtNumDoc = new JTextField();


	/**
	 * Create the dialog.
	 */
	public VistaSeleccionTitular(JFrame padre) {
		super(padre);
		setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
		setModal(true);
		setTitle("Comprobar Titular");
		lblError.setFont(new Font("Tahoma", Font.PLAIN, 11));
		lblError.setVisible(true);
		setResizable(false);
		
		
		getContentPane().setLayout(new BorderLayout());
		contentPanel.setBorder(new EmptyBorder(5, 20, 5, 20));
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.X_AXIS));
		{
			panelLabels.setBorder(null);
			contentPanel.add(panelLabels);
		}
		panelLabels.setLayout(new BoxLayout(panelLabels, BoxLayout.Y_AXIS));
		{
			lblUsuario.setBorder(new EmptyBorder(5, 0, 5, 0));
			lblUsuario.setAlignmentX(Component.RIGHT_ALIGNMENT);
			panelLabels.add(lblUsuario);
		}
		lblContrasea.setBorder(new EmptyBorder(5, 0, 5, 0));
		lblContrasea.setAlignmentX(Component.RIGHT_ALIGNMENT);
		panelLabels.add(lblContrasea);
		{
			contentPanel.add(panel_2);
		}
		{
			panelTextFields.setBorder(null);
			contentPanel.add(panelTextFields);
		}
		panelTextFields.setLayout(new BoxLayout(panelTextFields, BoxLayout.Y_AXIS));
		{
		}
		{
			comboBoxTipoDoc = new JComboBox<String>();
			comboBoxTipoDoc.setMaximumSize(new Dimension(32767, 22));
			panelTextFields.add(comboBoxTipoDoc);
			comboBoxTipoDoc.setModel(new DefaultComboBoxModel<String>(new String[] {"DNI", "LC", "LE"}));
		}
		{
			panelContrasenia.setBorder(new EmptyBorder(3, 0, 3, 0));
			panelTextFields.add(panelContrasenia);
		}
		panelContrasenia.setLayout(new BoxLayout(panelContrasenia, BoxLayout.X_AXIS));
		txtNumDoc.setMaximumSize(new Dimension(2147483647, 22));
		panelContrasenia.add(txtNumDoc);
		txtNumDoc.setColumns(10);
		{
			JPanel buttonPane = new JPanel();
			getContentPane().add(buttonPane, BorderLayout.SOUTH);
			buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.Y_AXIS));
			lblError.setForeground(Color.RED);
			lblError.setAlignmentX(Component.CENTER_ALIGNMENT);
			buttonPane.add(lblError);
			{
				buttonPane.add(panel_1);
			}
		}
		panel_1.setLayout(new BoxLayout(panel_1, BoxLayout.X_AXIS));
		{
			panel_1.add(panel_4);
		}
		{
			panel_1.add(panel_6);
		}
		{
			panel_1.add(panel_8);
		}
		{
			btnComprobar = new JButton("Comprobar");
			panel_1.add(btnComprobar);
			btnComprobar.setActionCommand("comprobar");
			getRootPane().setDefaultButton(btnComprobar);
		}
		{
			panel_1.add(panel_3);
		}
		{
			btnCancelar = new JButton("Cancelar");
			panel_1.add(btnCancelar);
			btnCancelar.setActionCommand("cancelar");
		}
		{
			panel_1.add(panel_9);
		}
		{
			panel_1.add(panel_7);
		}
		{
			panel_1.add(panel_5);
		}
		pack();
		setLocationRelativeTo(padre);
	}
	
	public JButton getBtnComprobar(){
		return btnComprobar;
	}
	public JButton getBtnCancelar(){
		return btnCancelar;
	}
	
	public JLabel getLblErrorInicio() {
		return lblError;
	}
	
	public JComboBox<String> getComboBoxTipoDoc(){
		return comboBoxTipoDoc;
	}
	
	public JTextField getTxtNumDoc(){
		return txtNumDoc;
	}


}
